<?php
class MW_Simplenews_Block_Detailnews extends Mage_Core_Block_Template 
{
	public function __construct(){
		parent::__construct();

		$id = $this->getRequest()->getParam('id');
		$detailnews = Mage::getModel('simplenews/news')->load($id);
		$this->setDetailnews($detailnews);

		$categoryName = $this->getCategoryName($id);
		$this->setCategory($categoryName);

		$this->setIdcategory($this->getCategoryId($id));
	}

	public function _prepareLayout(){
		return parent::_prepareLayout();
	}

	public function getCategoryName($id){
		$idCategory = $this->getCategoryId($id);
		$category = Mage::getModel('simplenews/category')->load($idCategory)->getData();
		return $category['title'];
	}

	public function getCategoryId($id){
		$category = Mage::getModel('simplenews/news')->load($id)->getData();
		return $category['category_id'];	
	}
}